package butines.game2.graph;

public class GraphEdge {

    // An edge connects two nodes. Valid node indices are always positive.
    private int from;
    private int to;

    // the cost of traversing the edge
    private float cost;

    public GraphEdge() {

    }

    public GraphEdge(int from, int to, float cost) {
        this.from = from;
        this.to = to;
        this.cost = cost;
    }

    public int getFrom() {
        return from;
    }

    public int getTo() {
        return to;
    }

    public void setFrom(int from) {
        this.from = from;
    }

    public void setTo(int to) {
        this.to = to;
    }

    public float getCost() {
        return cost;
    }

    public void setCost(float cost) {
        this.cost = cost;
    }
    
    public boolean equals(Object obj) {
        if (obj != null && obj instanceof GraphEdge) {
            GraphEdge other = (GraphEdge) obj;
            return to == other.to
                && from == other.from
                && cost == other.cost;
        }
        return false;
    }

}
